package com.lucky.auth_boot.controller;


import com.lucky.auth_boot.common.Result;
import com.lucky.auth_boot.pojo.dto.UserDTO;
import com.lucky.auth_boot.pojo.po.UserPO;
import com.lucky.auth_boot.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    UserService userService;

    @PostMapping("/register")
    public Result<?> addUserRegister(@RequestBody UserPO userPO) {
        return Result.success(userService.addUserRegister(userPO));
    }

    @GetMapping("/getUserListPage")
    public Result<?> getUserListPage(Pageable pageable) {
        return Result.success(userService.getUserListPage(pageable));
    }

    @GetMapping("/getUserOneById")
    public Result<?> getUserOneById(@RequestParam("id") Integer id) {
        return Result.success(userService.getUserOneById(id));
    }

    @PutMapping("/putUserStatus")
    public Result<?> putUserStatus(@RequestBody UserDTO userDTO) {
        return Result.success(userService.putUserStatus(userDTO));
    }

    @PutMapping("/putUserInfo")
    public Result<?> putUserInfo(@RequestBody UserDTO userDTO) {
        return Result.success(userService.putUserInfo(userDTO));
    }
}
